<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>老师账号管理</title>
    <style>
        body { background: #23272e; font-family: 'Microsoft YaHei', Arial, sans-serif; }
        .sidebar {
            position: fixed;
            top: 0; left: 0; bottom: 0;
            width: 200px;
            background: #181a20;
            padding-top: 60px;
            box-shadow: 2px 0 8px rgba(0,0,0,0.15);
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .sidebar ul {
            list-style: none; padding: 0; margin: 0; width: 100%;
        }
        .sidebar li {
            width: 100%;
        }
        .sidebar a {
            display: block;
            color: #e0e0e0;
            text-decoration: none;
            font-size: 18px;
            padding: 18px 0 18px 40px;
            transition: background 0.2s, color 0.2s;
        }
        .sidebar a:hover, .sidebar a.active {
            background: #2d313a;
            color: #4fc3f7;
        }
        .sidebar .logout {
            color: #ff8a65;
            margin-top: 40px;
            padding-left: 40px;
        }
        .container {
            width: 900px;
            margin: 60px auto 0 240px; /* Adjusted margin for sidebar */
            background: #181a20; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); padding: 40px; color: #b0b8c1; }
        h2 { margin-bottom: 30px; color: #fff; }
        table { width: 100%; border-collapse: collapse; margin-top: 20px; }
        th, td { border: 1px solid #2d313a; padding: 10px; text-align: center; }
        th { background: #2d313a; color: #4fc3f7; }
        tr:nth-child(even) { background: #23272e; }
        .btn { padding: 6px 16px; border: none; border-radius: 4px; cursor: pointer; margin: 0 4px; }
        .btn-add { background: #43a047; color: #fff; }
        .btn-edit { background: #1976D2; color: #fff; }
        .btn-del { background: #e53935; color: #fff; }
    </style>
</head>
<body>
<div class="sidebar">
    <ul>
        <li><a href="guanliyuan_index.jsp">首页</a></li>
        <li><a href="guanliyuan_student_manage">学生账号管理</a></li>
        <li><a href="guanliyuan_teacher_manage" class="active">老师账号管理</a></li>
        <li><a href="guanliyuan_course_manage">管理课程</a></li>
    </ul>
    <a href="logout" class="logout">退出登录</a>
</div>
<div class="container">
    <h2>老师账号管理</h2>
    <div style="margin-bottom: 20px; display: flex; align-items: center; justify-content: flex-start;">
        <form action="guanliyuan_teacher_manage" method="get" style="display: flex; gap: 10px; align-items: center;">
            <input type="text" name="teacherNumber" placeholder="按工号搜索" style="padding: 8px; border-radius: 4px; border: 1px solid #2d313a; background: #2d313a; color: #e0e0e0;">
            <input type="text" name="teacherName" placeholder="按姓名搜索" style="padding: 8px; border-radius: 4px; border: 1px solid #2d313a; background: #2d313a; color: #e0e0e0;">
            <input type="text" name="department" placeholder="按院系搜索" style="padding: 8px; border-radius: 4px; border: 1px solid #2d313a; background: #2d313a; color: #e0e0e0;">
            <button type="submit" class="btn btn-edit" style="padding: 8px 16px;">搜索</button>
        </form>
        <button class="btn btn-add" onclick="location.href='guanliyuan_add_teacher.jsp'" style="margin-left: auto;">添加老师</button>
    </div>
    <table>
        <tr>
            <th>ID</th>
            <th>工号</th>
            <th>用户名</th>
            <th>姓名</th>
            <th>性别</th>
            <th>院系</th>
            <th>邮箱</th>
            <th>电话</th>
            <th>操作</th>
        </tr>
        <c:forEach var="teacher" items="${teachers}">
            <c:url var="editTeacherUrl" value="/laoshi_edit_teacher">
                <c:param name="id" value="${teacher.id}"/>
            </c:url>
            <tr>
                <td><c:out value="${teacher.id}"/></td>
                <td><c:out value="${teacher.teacherNumber}"/></td>
                <td><c:out value="${teacher.username}"/></td>
                <td><c:out value="${teacher.name}"/></td>
                <td><c:out value="${teacher.gender}"/></td>
                <td><c:out value="${teacher.department}"/></td>
                <td><c:out value="${teacher.email}"/></td>
                <td><c:out value="${teacher.phone}"/></td>
                <td>
                    <button class="btn btn-edit" onclick="window.location.href = '${editTeacherUrl}';">编辑</button>
                    <button class="btn-del">删除</button>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>
</body>
</html> 